#pragma once

#include <boost/thread/thread.hpp>
#include <boost/ptr_container/ptr_list.hpp>
#include <boost/shared_ptr.hpp>
#include "OrbitElemTransform.h"
#include "Approach.h"

typedef auto_ptr<boost::thread> apBoostThread;

struct TrajParam
{
	typedef boost::shared_ptr<TrajParam> Ptr;

	double dStart;
	double dEnd;
	double dParamVal;
	COrbitElemTransform::Elements elem;
	IApproachHolder		*pApproachHolder;
};

typedef list<TrajParam::Ptr> ListTrajParamPtr;

class CApproachCalcThread
{
public:
	CApproachCalcThread(TrajParam::Ptr pTrajParam);
	~CApproachCalcThread();

	void Wait();
	bool IsDone(int nWaitMilliSec);
	LPCTSTR GetErrorStr() const;
protected:
	void do_work();
protected:
	apBoostThread	m_pThread;
	TrajParam::Ptr	m_pTrajParam;
	CStdString		m_strError;
};

typedef boost::ptr_list<CApproachCalcThread> ListPtr_CApproachCalcThread;
